<template>
<!--  <window-header :show-max="false" />-->
  <title-panel title="自由窗口" />
  <n-card>
    自由窗口参数：{{ params }}
  </n-card>

</template>

<script setup>
import { listen } from '@tauri-apps/api/event';

import { useWindow } from "@/hooks/useWindow.js";
const { setWindowCommonAttribute } = useWindow();

import { ref } from "vue";
const params = ref()

// 里面可以引入各种组件，根据接收的参数判断显示哪个组件
// 也可设置窗口失去焦点则隐藏窗口等功能
listen('show-free-window', async (event) => {
  console.log('自由窗口的参数：', event.payload);
  params.value = event.payload
  await setWindowCommonAttribute({
    label: 'free',
    visible: true,
    focus: true,
    position: event.payload.position || [],
    size: event.payload.size || [],
  })
});
</script>

<style scoped>

</style>
